<template>
  <div id="zonghe-list">
    <div class="all-tab">
      <div
        v-for="(item, index) in labels"
        :key="index"
        :class="{active: active === index}"
        @click="handleNavItemClick(index)"
      >
        {{ item.bookName }}
      </div>
    </div>
    <div class="btns">
      <div class="btn">
        <el-icon>
          <CirclePlus />
        </el-icon>
        <div>
          添加达成度
        </div>
      </div>
    </div>
    <div class="list">
      <div @click="$router.push('/zonghe/zonghedetails')">
        <div class="item-left"></div>
        <div class="item-right">
          <div class="item-title">2025级课程目标达成度统计</div>
          <div>学生人数：120人</div>
          <div>负责人：高老师</div>
          <div class="item-btns">
            <div>
              <el-icon>
                <DocumentCopy />
              </el-icon>
              复制
            </div>
            <div>
              <el-icon>
                <Delete />
              </el-icon>
              删除
            </div>
          </div>
        </div>
      </div>
      <div>
        <div class="item-left"></div>
        <div class="item-right">
          <div class="item-title">2025级课程目标达成度统计</div>
          <div>学生人数：120人</div>
          <div>负责人：高老师</div>
        </div>
      </div>
      <div>
        <div class="item-left"></div>
        <div class="item-right">
          <div class="item-title">2025级课程目标达成度统计</div>
          <div>学生人数：120人</div>
          <div>负责人：高老师</div>
        </div>
      </div>
      <div>
        <div class="item-left"></div>
        <div class="item-right">
          <div class="item-title">2025级课程目标达成度统计</div>
          <div>学生人数：120人</div>
          <div>负责人：高老师</div>
        </div>
      </div>
      <div>
        <div class="item-left"></div>
        <div class="item-right">
          <div class="item-title">2025级课程目标达成度统计</div>
          <div>学生人数：120人</div>
          <div>负责人：高老师</div>
        </div>
      </div>
    </div>
  </div>
</template>
  
  <script>
export default {
  components: {},
  data() {
    return {
      labels: [],
      active: 0,
    };
  },
  created() {
    this.getLabel();
  },
  methods: {
    getLabel() {
      const url = "/dify/getBookInfo";
      this.$axios.get(url).then((response) => {
        const res = response;
        if (res.code === 200) {
          console.log(res.data, 2);
          this.labels = res.data;
        }
      });
    },
    handleNavItemClick(index) {
      this.active = index;
      this.$router.push(this.teaNavList[index].url);
    },
  },
};
</script>
<style lang="scss" scoped>
#zonghe-list {
  .btns {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 30px;
    .btn {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 6px;
      width: 132px;
      height: 40px;
      background: #457aff;
      box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.05);
      border-radius: 5px;
      font-weight: 400;
      font-size: 14px;
      color: #ffffff;
      cursor: pointer;
      .el-icon {
        font-size: 18px;
      }
      &:hover {
        background: #3a66c7;
      }
    }
  }
  .list {
    display: flex;
    flex-wrap: wrap;
    > div {
      position: relative;
      overflow: hidden;
      width: calc(33.33% - 10px);
      margin-right: 15px;
      margin-bottom: 20px;
      border-radius: 5px;
      background: #ffffff;
      box-shadow: 0px 6px 32px 0px rgba(0, 0, 0, 0.28);
      display: flex;
      cursor: pointer;
      &:hover {
        transition: all 0.1s;
        transform: translateY(-5px);
      }
      &:nth-child(3n) {
        margin-right: 0;
      }
      .item-left {
        width: 130px;
        height: 130px;
        background: #5c75da;
      }
      .item-right {
        flex: 1;
        font-size: 14px;
        color: #3a3a3a;
        padding: 25px 20px 0 20px;
        box-sizing: border-box;
        .item-title {
          font-size: 18px;
          color: #3a3a3a;
          margin-bottom: 14px;
        }
        .item-btns {
          position: absolute;
          right: 20px;
          bottom: 14px;
          display: flex;
          gap: 10px;
          > div {
            color: #457aff;
            font-size: 14px;
            display: flex;
            align-items: center;
            &:hover {
              color: #3a66c7;
            }
          }
        }
      }
    }
  }
}
</style>